<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
    pageEncoding="ISO-8859-1"%>
<!DOCTYPE html>
<html lang="en">

<html>

<head>

<link rel="Stylesheet" type="text/css" href="css/Stylesheet.css">

</head>

<body>

<h1></h1>

<% String visitorName = (String) session.getAttribute("visitorName"); %>

<ul id="menu" align=center>
 <li><form id=NoBox action="ViewEventsofUserServlet" method="post"><input id="NoBox" type="submit" name="MyPortal" value="My Portal" /></form></li>
 <% if ((Integer)session.getAttribute("isAdmin")==0){%>
 <li><form id=NoBox action="UpdateVisitorServlet" method="get"><input id="NoBox" type="submit" name="Update Personal Data" value="Update Personal Data" /></form></li>
 <li><form id=NoBox action="UpdatePasswordServlet" method="get"><input id="NoBox" type="submit" name="Change Password" value="Change Password" /></form></li>
 <% } %>
 <% if ((Integer)session.getAttribute("isAdmin")==1){ %>
 <li><form id=NoBox action="EventRegistrationServlet" method="get"><input id="NoBox" type="submit" name="New Event" value="New Event" /></form></li>
 <li><form id=NoBox action="EventUpdateServlet" method="get"><input id="NoBox" type="submit" name="Update Event" value="Update Event" /></form></li>
 <% } %>
 <li><form id=NoBox action="ShowAllEventsServlet" method="get"><input id="NoBox" type="submit" name="Events" value="Events" /></form></li>
 <li><form id=NoBox action="LogOutServlet" method="post"><input id="NoBox" type="submit" name="LogOut" value="Log Out" /></form></li>
</ul>

<table>
<tr height="200" align="left">
<td>
<div id="places" align="left" text-align="left">
  <p id="placetitle">Places</p>
  <ul>

  	<li><b><ins ><a >North</a></b></ins></li>
	<li>	<form  id="places" action="ShowEventsByPlaceServlet" method="post">
			<input type="hidden" name="place" value="Stadium">
			<input id="places" type="submit" name="Stadium" value="Stadium" />
			</form></li>
	<li>	<form  id="places" action="ShowEventsByPlaceServlet" method="post">
			<input type="hidden" name="place" value="Theater">
			<input id="places" type="submit" name="Theater" value="Theater" />
			</form></li>
	<li>	<form  id="places" action="ShowEventsByPlaceServlet" method="post">
			<input type="hidden" name="place" value="Museum">
			<input id="places" type="submit" name="Museum" value="Museum" />
			</form></li>
	<li>	<form  id="places" action="ShowEventsByPlaceServlet" method="post">
			<input type="hidden" name="place" value="Large Business">
			<input id="places" type="submit" name="Large Business" value="Large Business" />
			</form></li>
	<li></li>
	<li><b><ins><a>South</a></b></ins></li>
	<li >	<form  id="places" action="ShowEventsByPlaceServlet" method="post">
			<input type="hidden" name="place" value="Zoo">
			<input id="places" type="submit" name="Zoo" value="Zoo" />
			</form></li>
	<li >	<form  id="places" action="ShowEventsByPlaceServlet" method="post">
			<input type="hidden" name="place" value="Park">
			<input id="places" type="submit" name="Park" value="Park" />
			</form></li>
	<li >	<form  id="places" action="ShowEventsByPlaceServlet" method="post">
			<input type="hidden" name="place" value="Traditional Market">
			<input id="places" type="submit" name="Traditional Market" value="Traditional Market" />
			</form></li>
	<li >	<form  id="places" action="ShowEventsByPlaceServlet" method="post">
			<input type="hidden" name="place" value="Tourist Attraction">
			<input id="places" type="submit" name="Tourist Attraction" value="Tourist Attraction" />
			</form></li>
  </ul>
</div>
</td>
<td>

<form action="UpdateVisitorServlet" method="post">

<h2>Festival Registration System</h2>
<h3> Update visitor </h3>
<h4>Fields marked (*) are Mandatory</h4>

<table align=center>
<tr>
	<td><label for="firstname">First Name: </label></td>
	<td><input type="text" name="firstname" id="firstname" placeholder="Enter your first name"  autofocus="autofocus" minlength="1" maxlength="30"></td>
</tr>

<tr>
	<td><label for="lastname">Last Name: </label></td>
	<td><input type="text" name="lastname" id="lastname" placeholder="Enter your last name"  autofocus="autofocus" minlength="1" maxlength="30"></td>
</tr>

<tr>
	<td><label for="dni">DNI: </label></td>
	<td><input type="text" name="dni" id="dni" placeholder="00-000-000-X"  autofocus="autofocus" 
pattern="[0-9]{2}-[0-9]{3}-[0-9]{3}-[A-Z]{1}" title="Please enter 8 numbers and a letter"></td>
</tr>

<tr>
	<td><label for="username">User Name: </label></td>
	<td><input type="text" name="username" id="username" placeholder="Enter your user name"  autofocus="autofocus" minlength="6" maxlength="12"></td>
</tr>


<tr>
	<td><label for="emailAddress">Email address </label></td>
	<td><input type="email" name="emailAddress" id="emailAddress" placeholder="name@example.com"  autofocus="autofocus" minlength="3" maxlength="200" /></td>
</tr>

<tr>
	<td><label for="phone">Phone Number: </label></td>
	<td><input type="text" name="phone" id="phone" placeholder="Enter your phone number"  autofocus="autofocus" minlength="10" maxlength="20" pattern="[0-9]{10,}" title="Please enter a valid phone number" /></td>
</tr>

<tr>
	<td><label for="addres">Address: </label></td>
	<td><input type="text" name="addres" id="addres" placeholder="Enter your address"  autofocus="autofocus" maxlength="30" /></td>
</tr>

<tr>
	<td><label for="password">*Password: </label></td>
	<td><input name="password" required="required" type="password" id="password" placeholder="Enter your password" required="required" autofocus="autofocus" minlength="6" maxlength="15"></td>
</tr>

<tr>
<td></td><td></td>
</tr>

<tr>
    <td></td>
	<td><input type="submit" name="Update" value="Update" />
	<button type="reset">Cancel</button></td>
</tr>

</table>

</form>


</td>
</tr>
</table>
<% String error = (String) session.getAttribute("error"); %>

<%if(error!=null){ %>
<script> 
alert ("<%=error%>");
</script>

<%session.setAttribute("error",null);} %>
</body>
</html>
